home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8333 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.ichange.com!newsmaster
  2. From: cmahoney@readysoft.es (Colin Mahoney)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Random dice program problem need help!!!!!
  5. Date: Fri, 16 Feb 1996 21:07:47 GMT
  6. Organization: AT&T Interchange Online Network
  7. Message-ID: <4g2rvd$41t@ias2.ichange.com>
  8. References: <4fqum6$pbj@news.bellglobal.com> <4fvo8n$jed@news.halcyon.com>
  9. NNTP-Posting-Host: 194.179.34.247
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. normanb@halcyon.com (Norm Bryar) wrote:
  13.  
  14. >rchartra@feldspar.com (Ron Chartrand) wrote:
  15.  
  16. >>I am using Borland C 4.52 i have been trying to make a callable
  17. >>routine to simulate rolling 3 six sided dice but it always comes out
  18. >>to be the same number?? need help!!!!!
  19.  
  20. >>//3d6 dice roll
  21. >>void Threed6()
  22. >>{
  23. >>randomize();
  24. >>dice1=0;
  25. >>dice2=0;
  26. >>dice3=0;
  27.  
  28. >>dice1=rand()%6+1;
  29. >>dice2=rand()%6+1;
  30. >>dice3=rand()%6+1;
  31. >>Total=dice1+dice2+dice3;
  32. >>}
  33.  
  34. >>just Email me at rchartra@feldspar.com 
  35.  
  36. >I'm not a Borland officianado, but one usually seeds the random number
  37. >generator with some "random" value at the beginning, say, of program
  38. >execution.  Usually one uses the time for the seed.  
  39.  
  40. >    srand( (unsigned)time( NULL ) );  in MSVC
  41.  
  42. >Does Borland's randomize() not accept a parameter for the seed value?
  43.  
  44. randomize() uses a time value as a seed . Is the clock on your
  45. computer OK? If time() always returns the same value, that would
  46. explain your problem
  47.  
  48. >                        --Norm 
  49.  
  50.  
  51.  
  52.  
  53. ---------------------------------------
  54. Colin Mahoney ( cmahoney@readysoft.es )
  55. Sabadell, Spain
  56. ---------------------------------------
  57.  
  58.